<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<%@ page import="javax.naming.Context"%> 
<%@ page import="javax.sql.DataSource"%> 
<%@ page import="javax.naming.InitialContext"%> 
<%@ page import="java.sql.*"%> 
<%@page import="dataconn.DbWrapper;"%> 

<html> 
<body> 
<%
request.setCharacterEncoding("utf-8");
String ProjectName=request.getParameter("ProjectName");
String sql="select count(*) from TestProject where ProjectName='"+ProjectName+"'";
int count=DbWrapper.nCount(sql);
if(count>0)
{
out.print("<br>该项目已经存在！<br>");
out.print("<a href='NewProject.jsp'>重新添加</a>");
return;}

sql="insert into TestProject(ProjectName,AddedByID) values('"+ProjectName+"','1')";
DbWrapper.executeUpdate(sql);
response.sendRedirect("NewProject.jsp");
%> 


  </body>
</html>